#ifndef _EVENT_TYPE_H_
#define _EVENT_TYPE_H_

#include "global_def.h"

typedef struct _CodeReason{
    i32 code;
    const char* reason;
}CodeReason;

const char *getCodeReason(i32 code);

enum EventID
{
    EVENT_MOBILE_GET_CODE_REQ = 0x01,
    EVENT_MOBILE_CODE_RSP = 0x02,

    EVENT_LOGIN_REQ = 0x03,
    EVENT_LOGIN_RSP = 0x04,
    
    EVENT_RECHARGE_REQ = 0x05,
    EVENT_RECHARGE_RSP = 0x06,

    EVENT_ACCOUNT_BALANCE_REQ = 0x07,
    EVENT_ACCOUNT_BALANCE_RSP = 0x08,

    EVENT_LIST_ACCOUNT_RECORDS_REQ = 0x09,
    EVENT_LIST_ACCOUNT_RECORDS_RSP = 0x10,

    EVENT_LIST_TRAVEL_RECORDS_REQ = 0x11,
    EVENT_LIST_TRAVEL_RECORDS_RSP = 0x12,

    EVENT_ERROR = 0xEF, 
    EVENT_UNKHOWN = 0xFF
};

enum ErrorCode
{
    ERRORCODE_SUCCESS = 200,
    ERRORCODE_INVALID_MSG = 400,
    ERRORCODE_INVALID_DATA = 404,
    ERRORCODE_METHOD_NOT_ALLOWED = 405,
    ERRORCODE_PROCESS_FAILED = 406,
    ERRORCODE_BIKE_IS_TOOK = 407,
    ERRORCODE_BIKE_IS_RUNNING = 408, 
    ERRORCODE_BIKE_IS_DAMAGED = 409,
    ERRORCODE_NULL = 0
};

static CodeReason Reasons[] = 
{
    {ERRORCODE_SUCCESS, "Ok."},
    {ERRORCODE_INVALID_MSG, "Invalid msg."},
    {ERRORCODE_INVALID_DATA, "Invalid data."},
    {ERRORCODE_METHOD_NOT_ALLOWED, "Method is not allowed."},
    {ERRORCODE_PROCESS_FAILED, "Server process failed."},
    {ERRORCODE_BIKE_IS_TOOK, "Bike is took."},
    {ERRORCODE_BIKE_IS_RUNNING, "Bike is running."},
    {ERRORCODE_BIKE_IS_DAMAGED, "Bike is damaged."}, 
    {ERRORCODE_NULL, "NULL."}
}; 


#endif